package com.yufei.infoExtractor.exportor;

import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.yufei.infoExtractor.exception.TaskResultExportException;
import com.yufei.infoExtractor.pfw.entity.Entity;
import com.yufei.infoExtractor.util.ExceptionUtil;
import com.yufei.infoExtractor.util.FileUtil;

public class ExcelDataExportor implements DataExportor {
	private static Log mLog = LogFactory.getLog(ExcelDataExportor.class);

	@Override
	public void exportData(List<? extends Entity> needSavedList,
			String destinationFoler, Class entityClass) throws TaskResultExportException {
		// TODO Auto-generated method stub
     try {
		FileUtil.makeExcelFileForTaskResult(needSavedList, destinationFoler, entityClass);
	} catch (Exception e) {
		// TODO Auto-generated catch block
		mLog.info("在将采集信息列表生成Excel文件时出错，错误信息是："+ExceptionUtil.getExceptionDetailsMessage(e)+"");
		throw new TaskResultExportException(ExceptionUtil.getExceptionDetailsMessage(e));
	}
	}

}
